<!DOCTYPE html>
<html>
<head>
    

    

    



    <meta charset="utf-8">
    
    
    
    
    <title>Anson&#39;s Blog | 种一棵树最好的时间在十年前，其次是现在。</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    
    <meta name="theme-color" content="#3F51B5">
    
    
    <meta name="keywords" content="">
    <meta name="description" content="张宁乐,博客">
<meta property="og:type" content="website">
<meta property="og:title" content="Anson&#39;s Blog">
<meta property="og:url" content="http://yoursite.com/page/2/index.html">
<meta property="og:site_name" content="Anson&#39;s Blog">
<meta property="og:description" content="张宁乐,博客">
<meta property="og:locale" content="zh-CN">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Anson&#39;s Blog">
<meta name="twitter:description" content="张宁乐,博客">
    
        <link rel="alternate" type="application/atom+xml" title="Anson&#39;s Blog" href="/atom.xml">
    
    <link rel="shortcut icon" href="/img/favicon.ico">
    <link rel="stylesheet" href="//unpkg.com/hexo-theme-material-indigo@latest/css/style.css">
    <script>window.lazyScripts=[]</script>

    <!-- custom head -->
    

</head>

<body>
    <div id="loading" class="active"></div>

    <aside id="menu"  >
  <div class="inner flex-row-vertical">
    <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="menu-off">
        <i class="icon icon-lg icon-close"></i>
    </a>
    <div class="brand-wrap" style="background-image:url(/img/brand.jpg)">
      <div class="brand">
        <a href="/" class="avatar waves-effect waves-circle waves-light">
          <img src="https://yscoder.github.io/img/face.jpg">
        </a>
        <hgroup class="introduce">
          <h5 class="nickname">张宁乐</h5>
          <a href="mailto:zhangningle2017@gmail.com" title="zhangningle2017@gmail.com" class="mail">zhangningle2017@gmail.com</a>
        </hgroup>
      </div>
    </div>
    <div class="scroll-wrap flex-col">
      <ul class="nav">
        
            <li class="waves-block waves-effect">
              <a href="/"  >
                <i class="icon icon-lg icon-home"></i>
                主页
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/archives"  >
                <i class="icon icon-lg icon-archives"></i>
                归档
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/tags"  >
                <i class="icon icon-lg icon-tags"></i>
                标签
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/about"  >
                <i class="icon icon-lg icon-user"></i>
                关于
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="https://github.com/ansonznl" target="_blank" >
                <i class="icon icon-lg icon-github"></i>
                Github
              </a>
            </li>
        
      </ul>
    </div>
  </div>
</aside>

    <main id="main">
        <header class="top-header" id="header">
    <div class="flex-row">
        <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light on" id="menu-toggle">
          <i class="icon icon-lg icon-navicon"></i>
        </a>
        <div class="flex-col header-title ellipsis">Anson&#39;s Blog</div>
        
        <div class="search-wrap" id="search-wrap">
            <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="back">
                <i class="icon icon-lg icon-chevron-left"></i>
            </a>
            <input type="text" id="key" class="search-input" autocomplete="off" placeholder="输入感兴趣的关键字">
            <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="search">
                <i class="icon icon-lg icon-search"></i>
            </a>
        </div>
        
        
        <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="menuShare">
            <i class="icon icon-lg icon-share-alt"></i>
        </a>
        
    </div>
</header>
<header class="content-header index-header">

    <div class="container fade-scale">
        <h1 class="title">Anson&#39;s Blog</h1>
        <h5 class="subtitle">
            
                种一棵树最好的时间在十年前，其次是现在。
            
        </h5>
    </div>

    


</header>

<div class="container body-wrap">

    <ul class="post-list">
    
        <li class="post-list-item fade">
            <article id="post-关于跨域"
  class="article-card article-type-post" itemprop="blogPost">

    <div class="post-meta">
        <time class="post-time" title="2019-03-15 20:04:55" datetime="2019-03-15T12:04:55.000Z"  itemprop="datePublished">
2019-03-15
<!--2019-03-15 20:32:26-->
</time>

        


    </div>

    


  
    <h3 class="post-title" itemprop="name">
      <a class="post-title-link" href="/2019/03/15/关于跨域/">关于跨域</a>
    </h3>
  




    <div class="post-content" id="post-content" itemprop="postContent">

    
        在使用Vue搭建的一个后端管理系统中，我使用axios请求本地的Node环境下的接口，但是请求失败，然后我错误信息是：
                
                    
                    
                
                331552554043_.pic.jpg
            大概意思就是不能访问h...
    

        <a href="/2019/03/15/关于跨域/" class="post-more waves-effect waves-button">
            阅读全文…
        </a>
    </div>
    
    <div class="post-footer">
        
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/JavaScript/">JavaScript</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/NodeJS/">NodeJS</a></li></ul>

    </div>
    
</article>

        </li>
    
        <li class="post-list-item fade">
            <article id="post-Vue中的验证登录状态"
  class="article-card article-type-post" itemprop="blogPost">

    <div class="post-meta">
        <time class="post-time" title="2019-03-09 22:21:55" datetime="2019-03-09T14:21:55.000Z"  itemprop="datePublished">
2019-03-09
<!--2019-03-09 18:33:19-->
</time>

        


    </div>

    


  
    <h3 class="post-title" itemprop="name">
      <a class="post-title-link" href="/2019/03/09/Vue中的验证登录状态/">Vue中的验证登录状态</a>
    </h3>
  




    <div class="post-content" id="post-content" itemprop="postContent">

    
        Vue项目中实现用户登录及token验证先说一下我的实现步骤： 

使用easy-mock新建登录接口，模拟用户数据
使用axios请求登录接口，匹配账号和密码
账号密码验证后， 拿到token，将token存储到sessionStorage中，并跳转到首页
前端每次跳转时，就使用导航守卫(vue-router.beforeEach)判断 sessionStorage 中有无 token，没...
    

        <a href="/2019/03/09/Vue中的验证登录状态/" class="post-more waves-effect waves-button">
            阅读全文…
        </a>
    </div>
    
    <div class="post-footer">
        
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Vue-js/">Vue.js</a></li></ul>

    </div>
    
</article>

        </li>
    
        <li class="post-list-item fade">
            <article id="post-我对JavaScript中this的一些理解"
  class="article-card article-type-post" itemprop="blogPost">

    <div class="post-meta">
        <time class="post-time" title="2019-02-21 18:34:03" datetime="2019-02-21T10:34:03.000Z"  itemprop="datePublished">
2019-02-21
<!--2019-02-21 20:38:31-->
</time>

        


    </div>

    


  
    <h3 class="post-title" itemprop="name">
      <a class="post-title-link" href="/2019/02/21/我对JavaScript中this的一些理解/">我对JavaScript中this的一些理解</a>
    </h3>
  




    <div class="post-content" id="post-content" itemprop="postContent">

    
        因为日常工作中经常使用到this，而且在JavaScript中this的指向问题也很容易让人混淆一部分知识。这段时间翻阅了一些书籍也查阅了网上一些资料然后结合自己的经验，为了能让自己更好的理解this，进而总结一篇文章。
this 是什么this是 JavaScript 语言的一个关键字。它是函数运行时，在函数体内部自动生成的一个对象，只能在函数体内部使用。实际是在函数被调用时才发生的绑定，...
    

        <a href="/2019/02/21/我对JavaScript中this的一些理解/" class="post-more waves-effect waves-button">
            阅读全文…
        </a>
    </div>
    
    <div class="post-footer">
        
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/JavaScript/">JavaScript</a></li></ul>

    </div>
    
</article>

        </li>
    
        <li class="post-list-item fade">
            <article id="post-理解JS原型链"
  class="article-card article-type-post" itemprop="blogPost">

    <div class="post-meta">
        <time class="post-time" title="2019-01-18 22:21:55" datetime="2019-01-18T14:21:55.000Z"  itemprop="datePublished">
2019-01-18
<!--2019-01-18 23:08:50-->
</time>

        


    </div>

    


  
    <h3 class="post-title" itemprop="name">
      <a class="post-title-link" href="/2019/01/18/理解JS原型链/">理解JS 原型链</a>
    </h3>
  




    <div class="post-content" id="post-content" itemprop="postContent">

    
        一直以来对于JavaScript 的原型链的概念，始终有些东西有一种模糊感，最近刚好有时间就塌下心认真的把《JavaScript高级程序设计》中相关内容认真读了一遍，也查看了很多网上很多资料，以前很多不明白的地方也渐渐明白了起来。写一篇文章记录一下最近学习的感悟。
字面量创建对象我们通常创建一个对象无非就两种方式：121. var obj= new Object();//new 一个Obje...
    

        <a href="/2019/01/18/理解JS原型链/" class="post-more waves-effect waves-button">
            阅读全文…
        </a>
    </div>
    
    <div class="post-footer">
        
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/JavaScript/">JavaScript</a></li></ul>

    </div>
    
</article>

        </li>
    
        <li class="post-list-item fade">
            <article id="post-使用Express搭建一个简单的服务器"
  class="article-card article-type-post" itemprop="blogPost">

    <div class="post-meta">
        <time class="post-time" title="2019-01-04 22:21:55" datetime="2019-01-04T14:21:55.000Z"  itemprop="datePublished">
2019-01-04
<!--2019-01-04 23:27:50-->
</time>

        


    </div>

    


  
    <h3 class="post-title" itemprop="name">
      <a class="post-title-link" href="/2019/01/04/使用Express搭建一个简单的服务器/">使用Express搭建一个简单的服务器</a>
    </h3>
  




    <div class="post-content" id="post-content" itemprop="postContent">

    
        Express框架Web 应用程序Express 是一个保持最小规模的灵活的 Node.js Web 应用程序开发框架，为 Web 和移动应用程序提供一组强大的功能。
API使用您所选择的各种 HTTP 实用工具和中间件，快速方便地创建强大的 API。
性能Express 提供精简的基本 Web 应用程序功能，而不会隐藏您了解和青睐的 Node.js 功能。
Express-路由基本使用下载...
    

        <a href="/2019/01/04/使用Express搭建一个简单的服务器/" class="post-more waves-effect waves-button">
            阅读全文…
        </a>
    </div>
    
    <div class="post-footer">
        
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/NodeJS/">NodeJS</a></li></ul>

    </div>
    
</article>

        </li>
    
        <li class="post-list-item fade">
            <article id="post-使用Node.js 搭建静态服务器"
  class="article-card article-type-post" itemprop="blogPost">

    <div class="post-meta">
        <time class="post-time" title="2018-12-21 16:21:55" datetime="2018-12-21T08:21:55.000Z"  itemprop="datePublished">
2018-12-21
<!--2018-12-21 16:22:28-->
</time>

        


    </div>

    


  
    <h3 class="post-title" itemprop="name">
      <a class="post-title-link" href="/2018/12/21/使用Node.js 搭建静态服务器/">使用NodeJS 搭建静态服务器</a>
    </h3>
  




    <div class="post-content" id="post-content" itemprop="postContent">

    
        
我们可以使用Node设定一个目录，然后让Web程序变成一个文件服务器。要实现这一点，我们只需要解析request.url中的路径，然后在本地找到对应的文件，把文件内容发送出去就可以了。

解析URL需要用到Node.js提供的url模块，它使用起来非常简单，通过parse()将一个字符串解析为一个Url对象：12var url= require(&apos;url&apos;);conso...
    

        <a href="/2018/12/21/使用Node.js 搭建静态服务器/" class="post-more waves-effect waves-button">
            阅读全文…
        </a>
    </div>
    
    <div class="post-footer">
        
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/NodeJS/">NodeJS</a></li></ul>

    </div>
    
</article>

        </li>
    
        <li class="post-list-item fade">
            <article id="post-使用Node.js写一个简单的api接口"
  class="article-card article-type-post" itemprop="blogPost">

    <div class="post-meta">
        <time class="post-time" title="2018-12-15 11:55:55" datetime="2018-12-15T03:55:55.000Z"  itemprop="datePublished">
2018-12-15
<!--2018-12-21 16:22:22-->
</time>

        


    </div>

    


  
    <h3 class="post-title" itemprop="name">
      <a class="post-title-link" href="/2018/12/15/使用Node.js写一个简单的api接口/">使用NodeJS写一个简单的api接口</a>
    </h3>
  




    <div class="post-content" id="post-content" itemprop="postContent">

    
        引入Http模块默认你已经安装了Node.jsNode当中内置了Http模块；可以使用1var http= require(&quot;http&quot;);
引入http模块；
Hello world用Node.js实现一个HTTP服务器程序非常简单。我们实现一个最简单的Web程序，它对于所有请求，都返回Hello world!，新建一个文件夹apiDemo 在里面新建一个server....
    

        <a href="/2018/12/15/使用Node.js写一个简单的api接口/" class="post-more waves-effect waves-button">
            阅读全文…
        </a>
    </div>
    
    <div class="post-footer">
        
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/NodeJS/">NodeJS</a></li></ul>

    </div>
    
</article>

        </li>
    
        <li class="post-list-item fade">
            <article id="post-JavaScript的预编译过程分析"
  class="article-card article-type-post" itemprop="blogPost">

    <div class="post-meta">
        <time class="post-time" title="2018-12-11 16:05:55" datetime="2018-12-11T08:05:55.000Z"  itemprop="datePublished">
2018-12-11
<!--2018-12-11 16:43:37-->
</time>

        


    </div>

    


  
    <h3 class="post-title" itemprop="name">
      <a class="post-title-link" href="/2018/12/11/JavaScript的预编译过程分析/">JavaScript的预编译过程分析</a>
    </h3>
  




    <div class="post-content" id="post-content" itemprop="postContent">

    
        一、JavaScript概念JavaScript ( JS ) 是一个单线程、解释型的编程语言。
二、JavaScript语言特点2.1 单线程JavaScript语言的一大特点就是单线程，也就是说，同一个时间只能做一件事。
2.2 解释型语言自上而下，解释一行，执行一行；不会通篇编译为一个文件再执行。
三、 JavaScript执行过程3.1 语法分析  顾名思义 就是检查一遍js代码内有...
    

        <a href="/2018/12/11/JavaScript的预编译过程分析/" class="post-more waves-effect waves-button">
            阅读全文…
        </a>
    </div>
    
    <div class="post-footer">
        
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/JavaScript/">JavaScript</a></li></ul>

    </div>
    
</article>

        </li>
    
        <li class="post-list-item fade">
            <article id="post-MongoDB学习之Mongoose的使用"
  class="article-card article-type-post" itemprop="blogPost">

    <div class="post-meta">
        <time class="post-time" title="2018-11-23 17:28:55" datetime="2018-11-23T09:28:55.000Z"  itemprop="datePublished">
2018-11-23
<!--2018-12-21 16:20:27-->
</time>

        


    </div>

    


  
    <h3 class="post-title" itemprop="name">
      <a class="post-title-link" href="/2018/11/23/MongoDB学习之Mongoose的使用/">初试MongoDB学习之Mongoose的使用</a>
    </h3>
  




    <div class="post-content" id="post-content" itemprop="postContent">

    
        mongoose简介mongoose官网：https://mongoosejs.com/
为什么要用Mongoose
Mongoose就是一个让我们可以通过Node来操作MongoDB的一个模块。Mongoose本质是一个对象文档模型（ODM）库，他对Node原生的MongoDB模块进行了一部优化封装，并且提供了更多的功能。

Mongoose的优势
可以像操作对象一样操作数据库
可以为文档...
    

        <a href="/2018/11/23/MongoDB学习之Mongoose的使用/" class="post-more waves-effect waves-button">
            阅读全文…
        </a>
    </div>
    
    <div class="post-footer">
        
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/MongoDB/">MongoDB</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/NodeJS/">NodeJS</a></li></ul>

    </div>
    
</article>

        </li>
    
        <li class="post-list-item fade">
            <article id="post-MongoDB中常用语句"
  class="article-card article-type-post" itemprop="blogPost">

    <div class="post-meta">
        <time class="post-time" title="2018-11-17 22:23:20" datetime="2018-11-17T14:23:20.000Z"  itemprop="datePublished">
2018-11-17
<!--2018-12-21 16:24:33-->
</time>

        


    </div>

    


  
    <h3 class="post-title" itemprop="name">
      <a class="post-title-link" href="/2018/11/17/MongoDB中常用语句/">MongoDB中常用语句</a>
    </h3>
  




    <div class="post-content" id="post-content" itemprop="postContent">

    
        MOngoDB  删除语句delete()删除

删除一个集合db.collection.deleteOne()
删除多个集合db.collection.deletMany();

remove()删除

删除所有的name：李四的数据db.student.remove({name:&quot;李四&quot;});
只删除一条sex:男的数据 仅删除一条db.student.remove(...
    

        <a href="/2018/11/17/MongoDB中常用语句/" class="post-more waves-effect waves-button">
            阅读全文…
        </a>
    </div>
    
    <div class="post-footer">
        
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/MongoDB/">MongoDB</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/NodeJS/">NodeJS</a></li></ul>

    </div>
    
</article>

        </li>
    
    </ul>

    
<nav id="page-nav">
    <div class="inner">
    <a class="extend prev" rel="prev" href="/">上一页</a><a class="page-number" href="/">1</a><span class="page-number current">2</span><a class="page-number" href="/page/3/">3</a><a class="page-number" href="/page/4/">4</a><span class="space">&hellip;</span><a class="page-number" href="/page/7/">7</a><a class="extend next" rel="next" href="/page/3/">下一页</a>
    </div>
</nav>


</div>

        <footer class="footer">
    <div class="top">
        
<p>
    <span id="busuanzi_container_site_uv" style='display:none'>
        站点总访客数：<span id="busuanzi_value_site_uv"></span>
    </span>
    <span id="busuanzi_container_site_pv" style='display:none'>
        站点总访问量：<span id="busuanzi_value_site_pv"></span>
    </span>
</p>


        <p>
            
                <span><a href="/atom.xml" target="_blank" class="rss" title="rss"><i class="icon icon-lg icon-rss"></i></a></span>
            
            <span>博客内容遵循 <a rel="license" href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh">知识共享 署名 - 非商业性 - 相同方式共享 4.0 国际协议</a></span>
        </p>
    </div>
    <div class="bottom">
        <p><span>张宁乐 &copy; 2017 - 2019</span>
            <span>
                
                Power by <a href="http://hexo.io/" target="_blank">Hexo</a> Theme <a href="https://github.com/yscoder/hexo-theme-indigo" target="_blank">indigo</a>
            </span>
			<span>
					Hosted by <a href="https://pages.coding.me" style="font-weight: bold">Coding Pages</a>
			  </span>
        </p>
    </div>
</footer>
<!-- <script>
(function(){
    var bp = document.createElement("script");
    var curProtocol = window.location.protocol.split(":")[0];
    if (curProtocol === "https") {
        bp.src = "https://zz.bdstatic.com/linksubmit/push.js";
    }
    else {
        bp.src = "http://push.zhanzhang.baidu.com/push.js";
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
})();
</script> -->

    </main>
    <div class="mask" id="mask"></div>
<a href="javascript:;" id="gotop" class="waves-effect waves-circle waves-light"><span class="icon icon-lg icon-chevron-up"></span></a>



<div class="global-share" id="globalShare">
    <ul class="reset share-icons">
      <li>
        <a class="weibo share-sns" target="_blank" href="http://service.weibo.com/share/share.php?url=http://yoursite.com/page/2/&title=Anson's Blog&pic=https://yscoder.github.io/img/face.jpg" data-title="微博">
          <i class="icon icon-weibo"></i>
        </a>
      </li>
      <li>
        <a class="weixin share-sns wxFab" href="javascript:;" data-title="微信">
          <i class="icon icon-weixin"></i>
        </a>
      </li>
      <li>
        <a class="qq share-sns" target="_blank" href="http://connect.qq.com/widget/shareqq/index.html?url=http://yoursite.com/page/2/&title=Anson's Blog&source=张宁乐,博客" data-title=" QQ">
          <i class="icon icon-qq"></i>
        </a>
      </li>
      <li>
        <a class="facebook share-sns" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=http://yoursite.com/page/2/" data-title=" Facebook">
          <i class="icon icon-facebook"></i>
        </a>
      </li>
      <li>
        <a class="twitter share-sns" target="_blank" href="https://twitter.com/intent/tweet?text=Anson's Blog&url=http://yoursite.com/page/2/&via=http://yoursite.com" data-title=" Twitter">
          <i class="icon icon-twitter"></i>
        </a>
      </li>
      <li>
        <a class="google share-sns" target="_blank" href="https://plus.google.com/share?url=http://yoursite.com/page/2/" data-title=" Google+">
          <i class="icon icon-google-plus"></i>
        </a>
      </li>
    </ul>
 </div>


<div class="page-modal wx-share" id="wxShare">
    <a class="close" href="javascript:;"><i class="icon icon-close"></i></a>
    <p>扫一扫，分享到微信</p>
    <img src="" alt="微信分享二维码">
</div>




    <script src="//cdn.bootcss.com/node-waves/0.7.4/waves.min.js"></script>
<script>
var BLOG = { ROOT: '/', SHARE: true, REWARD: false };


</script>

<script src="//unpkg.com/hexo-theme-material-indigo@latest/js/main.min.js"></script>


<div class="search-panel" id="search-panel">
    <ul class="search-result" id="search-result"></ul>
</div>
<template id="search-tpl">
<li class="item">
    <a href="{path}" class="waves-block waves-effect">
        <div class="title ellipsis" title="{title}">{title}</div>
        <div class="flex-row flex-middle">
            <div class="tags ellipsis">
                {tags}
            </div>
            <time class="flex-col time">{date}</time>
        </div>
    </a>
</li>
</template>

<script src="//unpkg.com/hexo-theme-material-indigo@latest/js/search.min.js" async></script>






<script async src="//dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>





</body>
</html>
